cmake_minimum_required(VERSION 2.8)
#########################################################################

# Basic environment setting
if(WIN32)
	SET(BUILD_PROJECT_NAME "libremote")
elseif(UNIX)
	SET(BUILD_PROJECT_NAME "remote")
endif()

#########################################################################
#INCLUDE_DIRECTORIES(${LIBVZNET_INCLUDE_DIR})
MESSAGE(STATUS "Print the include directores")
get_property(inc_dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
foreach(inc_dir ${inc_dirs})
  message(STATUS "    include directory='${inc_dir}'")
endforeach()

#########################################################################
#Step 2 : Add library directories
MESSAGE(STATUS "Step 2 : Add library directories")
#LINK_DIRECTORIES(${LIBVZNET_LIBRARY_DIR})
MESSAGE(STATUS "Print the link directores")
get_property(link_dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY LINK_DIRECTORIES)
foreach(link_dir ${link_dirs})
  message(STATUS "    link directory='${link_dir}'")
endforeach()

#########################################################################
#Step 3 : Add code source
SET(SRC_LIST 
	${CMAKE_CURRENT_SOURCE_DIR}/base/basedefines.h
	${CMAKE_CURRENT_SOURCE_DIR}/base/helps.cpp
	${CMAKE_CURRENT_SOURCE_DIR}/base/helps.h
	
	${CMAKE_CURRENT_SOURCE_DIR}/control/controlsession.h
	${CMAKE_CURRENT_SOURCE_DIR}/control/controlsession.cpp
	
	${CMAKE_CURRENT_SOURCE_DIR}/server/server.h
	${CMAKE_CURRENT_SOURCE_DIR}/server/server.cpp
	
	${CMAKE_CURRENT_SOURCE_DIR}/stanza/querystanza.h
	${CMAKE_CURRENT_SOURCE_DIR}/stanza/querystanza.cpp
	
	${CMAKE_CURRENT_SOURCE_DIR}/client/clientcontrolsession.h
	${CMAKE_CURRENT_SOURCE_DIR}/client/clientcontrolsession.cpp
	${CMAKE_CURRENT_SOURCE_DIR}/client/client.h
	${CMAKE_CURRENT_SOURCE_DIR}/client/client.cpp
	${CMAKE_CURRENT_SOURCE_DIR}/client/task.h
	${CMAKE_CURRENT_SOURCE_DIR}/client/task.cpp
	${CMAKE_CURRENT_SOURCE_DIR}/client/tunnelservices.h
	${CMAKE_CURRENT_SOURCE_DIR}/client/tunnelservices.cpp
	${CMAKE_CURRENT_SOURCE_DIR}/client/tunnelsession.h
	${CMAKE_CURRENT_SOURCE_DIR}/client/tunnelsession.cpp
	)

SOURCE_GROUP(server FILES
	${CMAKE_CURRENT_SOURCE_DIR}/server/server.h
	${CMAKE_CURRENT_SOURCE_DIR}/server/server.cpp
	)
	
SOURCE_GROUP(control FILES
	${CMAKE_CURRENT_SOURCE_DIR}/control/controlsession.h
	${CMAKE_CURRENT_SOURCE_DIR}/control/controlsession.cpp
	)
	
SOURCE_GROUP(base FILES
	${CMAKE_CURRENT_SOURCE_DIR}/base/basedefines.h
	${CMAKE_CURRENT_SOURCE_DIR}/base/helps.cpp
	${CMAKE_CURRENT_SOURCE_DIR}/base/helps.h
	)
	
SOURCE_GROUP(stanza FILES
	${CMAKE_CURRENT_SOURCE_DIR}/stanza/querystanza.h
	${CMAKE_CURRENT_SOURCE_DIR}/stanza/querystanza.cpp
	)

SOURCE_GROUP(client FILES
	${CMAKE_CURRENT_SOURCE_DIR}/client/clientcontrolsession.h
	${CMAKE_CURRENT_SOURCE_DIR}/client/clientcontrolsession.cpp
	${CMAKE_CURRENT_SOURCE_DIR}/client/client.h
	${CMAKE_CURRENT_SOURCE_DIR}/client/client.cpp
	${CMAKE_CURRENT_SOURCE_DIR}/client/task.h
	${CMAKE_CURRENT_SOURCE_DIR}/client/task.cpp
	${CMAKE_CURRENT_SOURCE_DIR}/client/tunnelservices.h
	${CMAKE_CURRENT_SOURCE_DIR}/client/tunnelservices.cpp
	${CMAKE_CURRENT_SOURCE_DIR}/client/tunnelsession.h
	${CMAKE_CURRENT_SOURCE_DIR}/client/tunnelsession.cpp
	)
#########################################################################
#Step 4 : Add PROJECT define 
MESSAGE(STATUS "Step 4 : Add code source")

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
#########################################################################
#Step 5 : Add executable or library target
ADD_LIBRARY(${BUILD_PROJECT_NAME} STATIC ${SRC_LIST})
set_property(TARGET ${BUILD_PROJECT_NAME} PROPERTY FOLDER ${PROJECT_SET_NAME_LIB})
#########################################################################
#Step 6 : link with other library
MESSAGE(STATUS "Step 6 : link with other library")

TARGET_LINK_LIBRARIES(${BUILD_PROJECT_NAME} 
	${LIBVZNET_LINK_LIB}
)